<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>工房受注管理</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>

		<script src="assets/scripts/ui/jquery-ui-1.7.2.custom.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript">
		$(function() {
		
			// メッセージのフェード
			$('.message').fadeIn("slow");

		});
		</script>
		
		<!--タイムコントロール -->
		<script>
		$(document).ready(function(){ 
			$("#delivery_date_1").wrDate();  
			$("#delivery_date_2").wrDate();  
			$("#m_date_1").wrDate();  
			$("#m_date_2").wrDate();  
		});

		$.extend({ 
			wrDate : function(objs) { 
			objs.each(function(i) { 
				//jQueryオブジェクトをトラバース
				var inputObj = $(this); 
				inputObj.datepicker({
					changeMonth: true,
					changeYear: true,
					dateFormat: 'yy/mm/dd'
				}); //各jQueryオブジェクトにCalendarコントロール
			}); 
		}});

		$.fn.extend({ 
			wrDate : function() { 
			//wrDate jQueryプラグインの名前を定義します
			$.wrDate(this); //呼び出す前に、カスタムjQuery関数 
		}});
		
		</script>	
		
		
		
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />

		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
		<script type="text/javascript">
			var sorter = new TINY.table.sorter("sorter");
				sorter.head = "head";
				sorter.asc = "asc";
				sorter.desc = "desc";
				sorter.even = "evenrow";
				sorter.odd = "oddrow";
				sorter.evensel = "evenselected";
				sorter.oddsel = "oddselected";
				sorter.paginate = true;
				sorter.currentid = "currentpage";
				sorter.limitid = "pagelimit";
			$(function(){
					sorter.init("inquiry_result",0);
			});
		</script>

		
	</head>
	<body id="" >
{{ php }} include( MENU_FILE ); {{ /php }}

		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>
		<div id="container"><div class="wrapper">

			<h2>工房受注管理</h2>
			<ul class="submenu clearfix">
				<li>受注検索</li>								
				<li><a href="order.php">受注登録</a></li>
				<li><a href="order_shop.php">商品マスタ</a></li>
			</ul>
			
			<h3>受注検索</h3>
					
			
			<p class="message">条件を入力し、検索ボタンをクリックしてください。</p>
			<form action="order_search.php" method="get">
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr>
						<th>種別</th>
						<td>
						<input type="checkbox" name="category1" value="1" {{ if $forms.category1 == 1 }}checked="checked"{{ /if }}  > プリント工房PRO</input>&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="category2" value="2" {{ if $forms.category2 == 2 }}checked="checked"{{ /if }} > プリント工房LITE</input>&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="category3" value="3" {{ if $forms.category3 == 3 }}checked="checked"{{ /if }} > 名刺工房</input>&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="category4" value="4" {{ if $forms.category4 == 4 }}checked="checked"{{ /if }} > アルバム工房</input>
						</td>
					</tr>
					<tr>
						<th>氏名</th>
						<td><input type="text" name="name" class="text" value="{{ $forms.name }}"  /></td>
					</tr>
					<tr>
						<th>フリガナ</th>
						<td><input type="text" name="kana" class="text" value="{{ $forms.kana }}" /></td>
					</tr>
					<tr>
						<th>メールアドレス</th>
						<td><input type="text" name="email" class="text" value="{{ $forms.email }}" /></td>
					</tr>
					<tr>
						<th>電話番号</th>
						<td><input type="text" name="phone" class="text" value="{{ $forms.phone }}" /></td>
					</tr>
					<tr>
						<th>納品日</th>
						<td><input type="text" id="delivery_date_1" class="text" name="delivery_date_1" style="width: 80px" value="{{ $forms.delivery_date_1 }}" />&nbsp;～&nbsp;<input type="text" id="delivery_date_2" class="text" name="delivery_date_2" style="width: 80px" value="{{ $forms.delivery_date_2 }}" /></td>
					</tr>
					<tr>
						<th>登録日</th>
						<td><input type="text" id="m_date_1" class="text" name="m_date_1" style="width: 80px" value="{{ $forms.m_date_1 }}" />&nbsp;～&nbsp;<input type="text" id="m_date_2" name="m_date_2" class="text" style="width: 80px" value="{{ $forms.m_date_2 }}" /></td>
					</tr>
					<tr>
						<th>支払方法</th>
						<td>
						<input type="checkbox" name="pay_type1" value="1" {{ if $forms.pay_type1 == 1 }}checked="checked"{{ /if }} /> 事前&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="pay_type2" value="2" {{ if $forms.pay_type2 == 2 }}checked="checked"{{ /if }} /> 代引き&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="pay_type3" value="3" {{ if $forms.pay_type3 == 3 }}checked="checked"{{ /if }} /> 請求書&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="pay_type4" value="4" {{ if $forms.pay_type4 == 4 }}checked="checked"{{ /if }} /> 現金払い
						</td>
					</tr>
					<tr>
						<th>受注ステータス</th>
						<td>
						<input type="checkbox" name="o_status1" value="0" {{ if $forms.o_status1 == 0 && $forms.o_status1!='' }}checked="checked"{{ /if }}  > 未確定</input>
						<input type="checkbox" name="o_status2" value="1" {{ if $forms.o_status2 == 1 }}checked="checked"{{ /if }}  > 確定</input>
						</td>
					</tr>
					<tr>
						<th>入金ステータス</th>
						<td>
						<input type="checkbox" name="m_status1" value="1"  {{ if $forms.m_status1 == 1 }}checked="checked"{{ /if }} > 有</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="m_status2" value="0" {{ if $forms.m_status2 == 0 && $forms.m_status2!=''}}checked="checked"{{ /if }} > 無</input>
						</td>
					</tr>
					<tr>
						<th>納品書出力</th>
						<td>
						<input type="checkbox" name="delivery_order1" value="1" {{ if $forms.delivery_order1 == 1 }}checked="checked"{{ /if }} > 出力済</input>
						<input type="checkbox" name="delivery_order2" value="0" {{ if $forms.delivery_order2 == 0 && $forms.delivery_order2!='' }}checked="checked"{{ /if }} > 未出力</input>
						</td>
					</tr>
					<tr>
						<th>発送メール送信</th>
						<td>
						<input type="checkbox" name="email_status1" value="1" {{ if $forms.email_status1 == 1 }}checked="checked"{{ /if }} > 送信済</input>
						<input type="checkbox" name="email_status2" value="0" {{ if $forms.email_status2 == 0 && $forms.email_status2!='' }}checked="checked"{{ /if }} > 未送信</input>
						</td>
					</tr>
					<tr>
						<th>売上ステータス</th>
						<td>
						<input type="checkbox" name="sale_status1" value="1"  {{ if $forms.sale_status1 == 1 }}checked="checked"{{ /if }} > 確定</input>&nbsp;&nbsp;&nbsp;
						<input type="checkbox" name="sale_status2" value="0" {{ if $forms.sale_status2 == 0 && $forms.sale_status2!='' }}checked="checked"{{ /if }} > 未確定</input>
						</td>
					</tr>
				</thead>			
			</table>
					
			<p class="button">
				<button type="submit" id="btn_search" class="submit"><span>検索</span></button>
			</p>
			</form><br/>
			
			<p class="message"><span style="color: red">{{$cnt}}</span>件登録されています</p>
			
			{{ if $cnt > 0 }}
			<h2>検索結果</h2>
			<form name="form1" action="order_csv.php" method="get">


{{ if $forms.category1 == 1 }}<input type="hidden" name="category1" value="1" />{{ /if }}
{{ if $forms.category2 == 2 }}<input type="hidden" name="category2" value="2" />{{ /if }}
{{ if $forms.category3 == 3 }}<input type="hidden" name="category3" value="3" />{{ /if }}
{{ if $forms.category4 == 4 }}<input type="hidden" name="category4" value="4" />{{ /if }}
<input type="hidden" name="name" class="hidden" value="{{ $forms.name }}"  />
<input type="hidden" name="kana" class="hidden" value="{{ $forms.kana }}" />
<input type="hidden" name="email" class="hidden" value="{{ $forms.email }}" />
<input type="hidden" name="phone" class="hidden" value="{{ $forms.phone }}" />

<input type="hidden"  name="delivery_date_1"  value="{{ $forms.delivery_date_1 }}" />
<input type="hidden"  name="delivery_date_2" value="{{ $forms.delivery_date_2 }}" />
<input type="hidden"  name="m_date_1" value="{{ $forms.m_date_1 }}" />
<input type="hidden"  name="m_date_2" value="{{ $forms.m_date_2 }}" />
{{ if $forms.pay_type1 == 1 }}<input type="hidden" name="pay_type1" value="1"  /> {{ /if }}
{{ if $forms.pay_type2 == 2 }}<input type="hidden" name="pay_type2" value="2"  /> {{ /if }}
{{ if $forms.pay_type3 == 3 }}<input type="hidden" name="pay_type3" value="3"  /> {{ /if }}
{{ if $forms.pay_type4 == 4 }}<input type="hidden" name="pay_type4" value="4"  /> {{ /if }}

{{ if $forms.o_status1 == 0 && $forms.o_status1!='' }}<input type="hidden" name="o_status1" value="0"   /> {{ /if }}
{{ if $forms.o_status2 == 1 }}<input type="hidden" name="o_status2" value="1" /> {{ /if }}
{{ if $forms.m_status1 == 1 }}<input type="hidden" name="m_status1" value="1" /> {{ /if }}
{{ if $forms.m_status2 == 0 && $forms.m_status2!=''}}<input type="hidden" name="m_status2" value="0" /> {{ /if }} 
{{ if $forms.delivery_order1 == 1 }}<input type="hidden" name="delivery_order1" value="1" /> {{ /if }} 
{{ if $forms.delivery_order2 == 0 && $forms.delivery_order2!='' }}<input type="hidden" name="delivery_order2" value="0"  /> {{ /if }}
{{ if $forms.email_status1 == 1 }}<input type="hidden" name="email_status1" value="1" /> {{ /if }} 
{{ if $forms.email_status2 == 0 && $forms.email_status2!='' }}<input type="hidden" name="email_status2" value="0"  /> {{ /if }}
{{ if $forms.sale_status1 == 1 }}<input type="hidden" name="sale_status1" value="1"  /> {{ /if }} 
{{ if $forms.sale_status2 == 0 && $forms.sale_status2!='' }}<input type="hidden" name="sale_status2" value="0"  />{{ /if }}
				
			<input type="hidden" name="page" value="{{ $page.current }}" />
			
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr align="center">
						<th>受注日</th>
						<th>サービス名</th>
						<th>氏名</th>
						<th>住所</th>
						<th>メールアドレス</th>
						<th>納品日</th>
						<th>参照</th>
					</tr>

				</thead>
				<tbody>
					
{{ foreach from=$list key=k item=v }}
					<tr >
						<td align="center">{{ $v.m_date }}</td>
						<td align="left">{{ $v.category }}</td>
						<td>{{ $v.name }}</td>
						<td>{{ $v.address }}</td>
						<td align="center"><a href="mailto:{{ $v.email }}">{{ $v.email }}</a></td>
						<td align="center">{{ $v.delivery_date }}</td>
						<td align="center"><a href="orderInfo.php?order_id={{ $v.order_id }}">[参照]</a></td>
					</tr>
{{ /foreach }}				
				</tbody>
			</table>
			
			<p align="center">
{{ if $page.current > 1 }}
				<a href="order_search.php?page={{ $page.current-1 }}{{ $page.query }}">前の{{ $page.item }}件</a>&nbsp;&nbsp;
{{ /if }}
{{ foreach from=$page.paging key=k item=v }}
{{ if $v < $page.current+15 }}
{{ if $page.current == $v }}
{{ $v }}&nbsp;
{{ else }}
				<a href="order_search.php?page={{ $v }}{{ $page.query }}">{{ $v }}</a>&nbsp;
{{ /if }}
{{ /if }}
{{ /foreach }}
{{ if $page.end > $page.current }}
				<a href="order_search.php?page={{ $page.current+1 }}{{ $page.query }}">次の{{ $page.item }}件</a>
{{ /if }}
			</p>			
			
			<p class="button">
				<button type="submit" id="btn_csv" class="submit"><span>CSV出力</span></button>
			</p>
		</form>
{{ /if }}
		</div></div>
			
			
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>

	</body>
</html>